package com.vcc.core.derive.converter.regulation;

import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
import cn.idev.excel.metadata.GlobalConfiguration;
import cn.idev.excel.metadata.data.ReadCellData;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.metadata.property.ExcelContentProperty;

/**
 * 充值订单事件转换器
 */
public class AmountTypeConverter implements Converter<Integer> {

    private static String useFlagToString(Integer useFlag) {
        //0,手续费返还
        //1,手续费补扣
        //2,罚金
        //3,返点发放
        //4,卡退款退还
        //6，强制平账
        return switch (useFlag) {
            case 0, 3, 4 -> "账户增加-账户充值";
            case 1, 2 -> "账户扣除-账户转出";
            default -> "账户扣除-卡充值";
        };
    }

    @Override
    public Class<Integer> supportJavaTypeKey() {
        return Integer.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }


    @Override
    public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return null;
    }


    @Override
    public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(useFlagToString(value));
    }
}